import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from "./http/index"


import echarts from 'echarts'
Vue.prototype.$echarts = echarts//挂载到原型，可以在全局使用

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);


import Print from 'vue-print-nb'
Vue.use(Print);


import i18n from './i8n/i8n';

import Vant from 'vant';
import 'vant/lib/index.css';

Vue.use(Vant);

import "./font1/iconfont.css"
// import "./views/index.scss"//修改的element中dialog样式


Vue.directive('watermark', {
  bind: function(el, binding) {
    el.addEventListener('load', function() {
      const canvas = document.createElement('canvas');
      canvas.width = el.width;
      canvas.height = el.height;
      const ctx = canvas.getContext('2d');

      // 绘制图片
      ctx.drawImage(el, 0, 0);

      // 绘制水印文本
      ctx.font = '30px Arial';
      ctx.fillStyle = 'rgba(0, 0, 0, 0.3)'; // 设置水印颜色和透明度
      ctx.textAlign = 'center';
      ctx.textBaseline = 'middle'; // 修改为小写的'middle'

      const watermarkTexts = binding.value.split(';'); // 多个水印文本以分号分隔
      const angle = -20 * Math.PI / 180; // 水印旋转角度
      const interval = 100; // 水印间隔

      for (let i = 0; i < watermarkTexts.length; i++) {
        ctx.save(); // 保存当前环境状态
        ctx.translate(canvas.width/2, canvas.height/2); // 平移坐标系到图片中心
        ctx.rotate(angle); // 旋转坐标系
        ctx.fillText(watermarkTexts[i].trim(), 0, i * interval); // 在新坐标系中绘制水印文本
        ctx.restore(); // 恢复上一个环境状态
      }

      // 替换原始图片
      el.src = canvas.toDataURL('image/jpeg');
    });
  }
});


import customDirectives from './views/index.js';
Vue.use(customDirectives);



import VXETable from 'vxe-table'
import 'vxe-table/lib/style.css'
Vue.use(VXETable)


import VueClipboard from 'vue-clipboard2'
Vue.use(VueClipboard)


import VueLazyload from 'vue-lazyload'
Vue.use(VueLazyload, {
  preLoad: 1.3,
  error: "https://pic.quanjing.com/ah/m1/QJ8494984482.jpg@%21350h",
  loading: "https://img2.baidu.com/it/u=1315662975,211120593&fm=253&fmt=auto&app=138&f=GIF?w=300&h=300",
  attempt: 1
})


import Avue from '@smallwei/avue';
import '@smallwei/avue/lib/index.css';
Vue.use(Avue);


import BaiduMap from 'vue-baidu-map'
Vue.use(BaiduMap, {
  // ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
  ak: 'XXX'
})


Vue.config.productionTip = false

new Vue({
  data(){
   return{
    isUpdate:true //根组件属性
   }
  },
  router,
  store,
  i18n,
  render: h => h(App)
 }).$mount('#app')
 
